package br.com.sgi.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import br.com.sgi.dao.UsersIgrejaDao;
import br.com.sgi.model.UsersIgreja;
import br.com.sgi.service.UsersIgrejaService;

@Service("usersIgrejaService")
public class UsersIgrejaServiceImpl implements UsersIgrejaService {

	@Autowired
	private UsersIgrejaDao usersIgrejaDao; 
	
	@Override
	public List<UsersIgreja> buscarUsersIgrejaPorCoUsers(String usernames) {
		 Map<String, Object>  params = new java.util.HashMap<String, Object>();
		 params.put("username", usernames);
		return usersIgrejaDao.findByNamedParams("buscarUserIgrejaPorUser", params);
	}

	@Override
	public void salvar(UsersIgreja usersIgreja) {
		usersIgrejaDao.save(usersIgreja);
		
	}

	@Override
	public void excluir(Long coUsersIgreja) {
		usersIgrejaDao.deleteById(coUsersIgreja);
		
	}

	@Override
	public List<UsersIgreja> buscarUsersIgrejaPorCoIgreja(Long coIgreja) {
		 Map<String, Object>  params = new java.util.HashMap<String, Object>();
		 params.put("coIgreja", coIgreja);
		return usersIgrejaDao.findByNamedParams("buscarUserIgrejaCoIgreja", params);
	}


}
